
 /* OVERVIEW OF DO FILE
We have four congresses 109-112. We will do the matching separately for each Congress and then do a pooled analysis as well. 

These analyses use the PINK measure of working class and the DV is the 1st dimension of the DW-NOMINATE score
*/
 
 
clear
*cd "/Users/nweller/Dropbox/class_pcs_project/ClassSession_Final/PRQ Revisions/Data"
 
use "LegislatorDataPCS.dta"

*cd "/Users/nweller/Dropbox/class_pcs_project/ClassSession_Final/PRQ Revisions/Data/Matching/NOMINATE"

   
*log using "NOMINATE.log", replace

replace median_hh=median_hh/1000
 

**109th Congresses
table member_wc_pink if cong==109

imb median_hh share_black share_latino  dist_pct_union votepct_updated dem_vote_share party if cong==109, tr(member_wc_pink)

cem median_hh(#3) share_black party share_latino dist_pct_union dem_vote_share party   if cong==109, tr(member_wc_pink)

gen T109 =member_wc_pink 
label variable T109 "109th Congress"

eststo cong109DW:reg dw1 T109 median_hh share_black party share_latino  dist_pct_union party dem_vote_share [iweight=cem_weights] if cong==109 , robust

ren cem_matched cem_matched109
table cem_matched109

outreg2 using NOMINATE.xls, replace title("Effect of Working-Class Legislator on DW-NOMINATE") ///
label ctitle("109th Congress")


*110th Congresses
table member_wc_pink if cong==110

imb median_hh share_black share_latino  dist_pct_union votepct_updated dem_vote_share  party if cong==110, tr(member_wc_pink)

cem median_hh(#3) share_black party share_latino dist_pct_union dem_vote_share party  if cong==110, tr(member_wc_pink)

gen T110 =member_wc_pink 
label variable T110 "110th Congress"

eststo cong110DW:reg dw1 T110 median_hh share_black party share_latino party  dist_pct_union dem_vote_share [iweight=cem_weights] if cong==110, robust

ren cem_matched cem_matched110
table cem_matched110

outreg2 using NOMINATE.xls, append label ctitle("110th Congress")


*111th Congresses
table member_wc_pink if cong==111

imb median_hh share_black share_latino  dist_pct_union votepct_updated dem_vote_share party if cong==111, tr(member_wc_pink)

cem median_hh(#3) share_black party share_latino  dist_pct_union dem_vote_share party if cong==111, tr(member_wc_pink)

gen T111 =member_wc_pink 
label variable T111 "111th Congress"

eststo cong111DW: reg dw1 T111 median_hh share_black party share_latino  dist_pct_union party dem_vote_share [iweight=cem_weights] if cong==111, robust


ren cem_matched cem_matched111
table cem_matched111

outreg2 using NOMINATE.xls, append label ctitle("111th Congress  ")



*112th Congresses
table member_wc_pink if cong==112

imb median_hh share_black share_latino  dist_pct_union votepct_updated dem_vote_share party if cong==112, tr(member_wc_pink)

cem median_hh(#3) share_black party share_latino  dist_pct_union dem_vote_share party if cong==112, tr(member_wc_pink)

gen T112 =member_wc_pink 
label variable T112 "112th Congress"

eststo cong112DW:reg dw1 T112 median_hh share_black party share_latino  dist_pct_union party dem_vote_share [iweight=cem_weights] if cong==112, robust

ren cem_matched cem_matched112
table cem_matched112

outreg2 using NOMINATE.xls, append title("Effect of Working-Class Legislator on Bill Introduction") ///
label ctitle("112th Congress")


**All Congresses 
quietly tabulate cong, generate(new_congress)
table member_wc_pink

imb median_hh share_black share_latino  dist_pct_union votepct_updated dem_vote_share cong party, tr(member_wc_pink)

cem median_hh(#3) share_black party share_latino dw1(#2) dist_pct_union dem_vote_share cong party, tr(member_wc_pink)

gen Tall =member_wc_pink 
label variable Tall "All Congresses"

eststo AllCongDW:reg dw1 Tall median_hh share_black party share_latino  dist_pct_union party dem_vote_share i.cong [iweight=cem_weights] , robust


ren cem_matched cem_matchedALL
table cem_matchedALL

outreg2 using NOMINATE.xls, append label ctitle("All Congresses")

label variable T109 `""109th Congress" "2005-07""'
label variable T110 `""110th Congress" "2007-09""'
label variable T111 `""111th Congress" "2009-11""'
label variable T112 `""112th Congress" "2011-13""' 
label variable Tall `""All Congresses" "2007-13""' 


**Plot of Margins Result
	
	coefplot ///
    (cong109DW, msymbol(O) mcolor(black) lcolor(black)) ///
    (cong110DW, msymbol(O) mcolor(black) lcolor(black)) ///
    (cong111DW, msymbol(O) mcolor(black) lcolor(black)) ///
    (cong112DW, msymbol(O) mcolor(black) lcolor(black)) ///
    (AllCongDW, msymbol(O) mcolor(black) lcolor(black)), ///
	keep (T109 T110 T111 T112 Tall) ///
    scheme(s1mono) ///
    xline(0) ///
	offset(0) ///
    level(90) ///
    legend(off) ///
	 ciopts(recast(rcap) lcolor(black)) ///
    xtitle(Roll Call Conservatism)

graph save Figure4.gph, replace

*log close

clear


